﻿using System;
using Yeap.Controllers.Filters;
using Yeap.Config;

namespace Yeap.Controllers
{
    [AuthenticationFilter]
    public class Controller : System.Web.Mvc.Controller
    {
        public virtual String Name
        {
            get
            {
                return Constants.Controllers.Default;
            }
        }

        protected Int32 TryGetIntParam(String paramName, Int32 defaultValue)
        {
            if (Request[paramName] != null)
            {
                Int32 parsedValue;
                if (Int32.TryParse(Request[paramName], out parsedValue))
                {
                    return parsedValue;
                }
            }
            return defaultValue;
        }
    }
}
